<?php
$sale_pro = new Default_Models_Product();
$spro = $sale_pro->getSaleProducts();
$pd = new Default_Models_Sale();
$count = 0;
if ($spro) {
    ?>
    <h3>Sản phẩm đang giảm giá</h3>
    <div class="pro-list">
        <?php
        foreach ($spro as $sp) {
            ?>
            <div class="pro-item">
                <a href="<?php echo URL_BASE; ?>/product/detail/<?php echo $sp->getProId(); ?>"><image src="<?php echo URL_BASE . DS . $sp->getThumb(); ?>"></a>
                <a href="<?php echo URL_BASE; ?>/product/detail/<?php echo $sp->getProId(); ?>"><?php echo $sp->getName(); ?></a>
                <span class="price p-new"><?php echo number_format($sp->getPrice() - $sp->getPrice() * $pd->getPdByProId($sp->getProId()) / 100, 0, ',', '.'); ?> VNĐ</span>
                <span class="price p-old"><?php echo number_format($sp->getPrice(), 0, ',', '.'); ?> VNĐ</span>
            </div>
            <?php
            $count++;
            if ($count > 2) {
                break;
            }
        }
        ?>
    </div>
    <?php
}
?>